package com.wxg.junit.appendix.B3;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;

import org.junit.Test;

import static com.wxg.junit.appendix.B3.IsStrongPassword.*;

/**
 * {@link Assert}
 *
 * @author Wxg
 */
public class TestIsPasswordStrongUsingMatcher {

    @Test
    public void testIsPasswordStrongIsStrong() {
        final String pass = "!abcde0";

        assertThat(pass, isStrongPassword());
        assertThat(pass, is(strongPassword()));
    }

    @Test(expected = java.lang.AssertionError.class)
    public void testIsPasswordStrongTooShort() {
        final String pass = "ae0!";

        assertThat(pass, isStrongPassword());
        assertThat(pass, is(strongPassword()));
    }

    @Test(expected = java.lang.AssertionError.class)
    public void testIsPasswordStrongContainsNoSpecialCharacter() {
        final String pass = "abcdef012";

        assertThat(pass, isStrongPassword());
        assertThat(pass, is(strongPassword()));
    }

    @Test(expected = java.lang.AssertionError.class)
    public void testIsPasswordStrongContainsNoDigit() {
        final String pass = "!abcdefg";

        assertThat(pass, isStrongPassword());
        assertThat(pass, is(strongPassword()));
    }

    @Test(expected = java.lang.AssertionError.class)
    public void testIsPasswordStrongIsNull() {
        final String pass = null;

        assertThat(pass, isStrongPassword());
        assertThat(pass, is(strongPassword()));
    }

}
